package com.stu.controller;

import com.stu.entity.SysUser;
import com.stu.service.SysUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@Slf4j
//@RequestMapping("/sysUser")
public class SysUserController {

    @Autowired
    SysUserService userService;

    @RequestMapping("/login")
    public Map<String, Object> login(SysUser sysUser) {
        System.out.println("jinru");
        log.info("11111-------------");
        Map<String, Object> map = new HashMap<>();
        SysUser user = userService.login(sysUser);
        if (null != user) {
            map.put("成功", user);
        }else {
            map.put("失败", null);
        }

        return map;
    }
}
